'use strict';

module.exports = app => {
  const { STRING, INTEGER, CHAR, DATE } = app.Sequelize;

  const Addresses = app.model.define('Addresses', {
    id: {
      type: INTEGER(10).UNSIGNED,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
    },
    consignee: {
      type: CHAR(20),
      allowNull: false,
    },
    prefix: {
      type: INTEGER(4).UNSIGNED,
      allowNull: false,
    },
    phone: {
      type: INTEGER(11).UNSIGNED,
      allowNull: false,
    },
    address: {
      type: STRING(255),
      allowNull: false,
    },
    zipCode: {
      type: CHAR(6),
      allowNull: false,
    },
    cityId: {
      type: INTEGER(6).UNSIGNED,
      allowNull: false,
    },
    city: {
      type: STRING(255),
      allowNull: false,
    },
    provinceId: {
      type: INTEGER(6).UNSIGNED,
      allowNull: false,
    },
    province: {
      type: STRING(255),
      allowNull: false,
    },
    createdAt: {
      type: DATE,
      allowNull: false,
    },
    updatedAt: {
      type: DATE,
      allowNull: false,
    },
  });

  return Addresses;

};